package com.example.testdemo.default_recycler_view_adapter;

import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.example.testdemo.R;
import com.example.testdemo.general_data.ImgList;


/**
 * Created by 颜 on 04.02.002.
 * 原生适配器
 */

public class DefaultRecyclerViewAdapterActivity extends Activity{
    private RecyclerView recyclerView;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_default_recycler_view_adatper);
        recyclerView = findViewById(R.id.recycler_view);
        recyclerView.setLayoutManager(new LinearLayoutManager(this,LinearLayoutManager.VERTICAL,false));
        initData();
    }

    private void initData() {
        DefaultAdapter adapter = new DefaultAdapter(this);
        adapter.setData(ImgList.getIdImage());
        recyclerView.setAdapter(adapter);
    }
}